package cn.fudong.bos.mq;

import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.stereotype.Service;

import cn.fudong.bos.utils.SMS_AlYun_High_Test;

/**
 * 
 * @description:自动分单成功发短信通知快递员
 * @author ：d_fu
 * @date 创建时间：2018年3月24日 下午8:07:33
 *
 */
@Service("smsCourier")
public class SmsCourier implements MessageListener {

	@Override
	public void onMessage(Message message) {
		MapMessage mapMessage = (MapMessage) message;
		// 给客户发短息
		try {
			/*
			 * boolean result =
			 * SMS_AlYun_High_Test.sendSms(mapMessage.getString(
			 * "courierTelephone"), mapMessage.getString("smsNumber"),
			 * mapMessage.getString("sendAddress"),
			 * mapMessage.getString("sendMobile"),
			 * mapMessage.getString("remark"));
			 */
			String smsNumber = mapMessage.getString("smsNumber");
			boolean result = true;

			if (result) {
				// 发送成功
				System.out.println("短信编号:" + smsNumber + "给快递员短信发送成功");

				// 发送失败
			} else {
				throw new RuntimeException("给快递员短信发送成功");
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
